Skip to content

Comments

Тест 2. Муромцева Татьяна Б43#12

Open
dacaott wants to merge 3 commits intomainfrom
test2
Open

Тест 2. Муромцева Татьяна Б43#12
dacaott wants to merge 3 commits intomainfrom
test2

Conversation

@dacaott
Copy link
Owner

@dacaott dacaott commented Dec 15, 2025

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это не схема Уолкера, а наивный алгоритм. Тот факт, то у вас есть цикл в get_random должен на это намекать

Comment on lines +61 to +79
input_str = input("Введите строку битов для шифрования: ").strip()

if not all(c in "01" for c in input_str):
print("Ошибка! строка должна состоять только из 0 и 1")
exit()

data_bits = [int(c) for c in input_str]

# Кодируем
encoded_message = hamming_encode(data_bits)
print("Закодированное сообщение:", "".join(map(str, encoded_message)))

# Декодируем
corrected_data, error_pos = hamming_decode(encoded_message)

if error_pos == 0:
print("Ошибок не обнаружено")
else:
print(f"Обнаружена ошибка в позиции: {error_pos}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если бы здесь можно было материться, я бы это делал. Не надо в модуль пихать неприкрытую if __name__ == "__main__" IO логику

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants